package manager

type Ping struct {
	Hostname string `json:"hostname"`
}

type Pong struct {
	Hostname string `json:"hostname"`
	ID       int    `json:"id"`
}

/***************
 * message layer: wrapper -> VoteWrapper/MsgWrapper
 * message layer: VoteWrapper -> prepare phase, accept phase
 * message layer: MsgWrapper -> Prepare/Promise/Accept/Accepted
 ***************/

type Wrapper struct {
	Hostname string `json:"hostname"`
	Payload []byte  `json:"payload"`
	Type int       `json:"type"`
}

type VoteWrapper struct {
	Type    int    `json:"type"`
	Payload []byte `json:"payload"`
}

type Vote struct {
	Hostname string `json:"hostname"` // self hostname
	Agreed   bool   `json:"agreed"`
	View     int    `json:"view"`
	Target   string `json:"target"`  // target hostname
}

type MsgWrapper struct {
	Type    int    `json:"type"`
	Payload []byte `json:"payload"`
}

type Propose struct {
	Hostname string `json:"hostname"` // self hostname
	View     int    `json:"view"`
	SeqNo    int    `json:"seqNo"`
	Payload  []byte `json:"payload"` // temporary means value
}
